public class Demo15 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
            while(true){
                //此处不加任何sleep
                //加打印也可以，但是会干扰到下面的打印
                //对于t来说，就是TIMED_WATTING状态--sleep()
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    //throw new RuntimeException(e);
                    e.printStackTrace();
                }
            }
        });
        System.out.println(t.getState()+"  isAlive:"+t.isAlive());
        t.start();
        System.out.println(t.getState()+"  isAlive:"+t.isAlive());

        //对于main来说，就是WAITTING状态
        t.join();

        System.out.println(t.getState()+"isAlive:"+t.isAlive());
    }
}
